<template>
  <view class="pb-6 pt-20">
    <view class="w100 pl-30 pr-30">
      <uni-card v-if="typeAudit">
        <view class="inforClass">任务信息</view>
        <view class="rowsb rowsm mb-20 mt-20 fs-26">
          <view class="ellipsis-text">
            <text class="fw-600 fs-26"> 任务名称：</text>
            <text> {{ taskInfo.taskName }}</text>
          </view>
        </view>
        <view class="rowsb rowsm mb-20 mt-20 fs-26">
          <view class="ellipsis-text">
            <text class="fw-600 fs-26"> 实践课程：</text>
            <text>
              <!-- {{ taskInfo.taskType == 1 ? '劳动教育' : taskInfo.taskType == 2 ? '职业素养' :
                taskInfo.taskType == 3 ? '应急安全' : taskInfo.taskType == 4 ? '思政实践' : '创新创业' }} -->
              {{ (practiceType.find(v => v.value == taskInfo.taskType) || {}).name }}
            </text>
          </view>
          <view class="ellipsis-text">
            <text class="fw-600 fs-26"> 积分上限：</text>
            <text> {{ taskInfo.pointsCap }}</text>
          </view>
        </view>
      </uni-card>
      <uni-card margin="0" v-if="typeAudit">
        <view class="inforClass">学生信息</view>
        <view class="rowsb rowsm mb-20 mt-20 fs-26">
          <view class="ellipsis-text">
            <text class="fw-600 fs-26"> 姓名：</text>
            <text> {{ taskInfo.studentName }}</text>
          </view>
          <view class="ellipsis-text">
            <text class="fw-600 fs-26"> 学号：</text>
            <text> {{ taskInfo.stNumber }}</text>
          </view>
        </view>
        <view class="rowsb rowsm mb-20 mt-20 fs-26">
          <uni-tooltip :content="taskInfo.xyName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 学院：</text>
              <text> {{ taskInfo.xyName }}</text>
            </view>
          </uni-tooltip>
          <uni-tooltip :content="taskInfo.zyName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 专业：</text>
              <text> {{ taskInfo.zyName }}</text>
            </view>
          </uni-tooltip>
        </view>
        <view class="rowsb rowsm mb-20 mt-20 fs-26">
          <uni-tooltip :content="taskInfo.bjName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 班级：</text>
              <text> {{ taskInfo.bjName }}</text>
            </view>
          </uni-tooltip>
          <uni-tooltip :content="taskInfo.njName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 年级：</text>
              <text> {{ taskInfo.njName }}</text>
            </view>
          </uni-tooltip>
        </view>
      </uni-card>

      <uni-card margin="0" v-else>
        <view>
          <view class="inforClass"> 任务名称：{{ taskInfo.taskName }}</view>
          <view class="rowsb rowsm mt-20 fs-24">
            <view style="width: 50%">
              <text class="fw-600 fs-26"> 实践课程：</text>
              <text>
                <!-- {{ taskInfo.practiceType == 1 ? '劳动教育' : taskInfo.practiceType == 2 ? '职业素养' :
                  taskInfo.practiceType == 3 ? '应急安全' : taskInfo.practiceType == 4 ? '思政实践' : '创新创业' }} -->
                {{ (practiceType.find(v => v.value == taskInfo.practiceType) || {}).name }}
              </text>
            </view>
            <view style="width: 50%">
              <text class="fw-600 fs-26"> 任务状态：</text>
              <text>{{ taskInfo.taskStatus == 1 ? '未开始' : taskInfo.taskStatus == 2 ? '进行中' : '已结束' }}</text>
            </view>
          </view>
          <view class="rowsb rowsm mt-20 fs-26">
            <view style="width: 50%">
              <text class="fw-600 fs-26"> 积分上限：</text>
              <text>{{ taskInfo.pointsCap }}</text>
            </view>
            <view style="width: 50%">
              <text class="fw-600 fs-26"> 任务次数：</text>
              <text>{{ taskInfo.taskNumber }}次</text>
            </view>
          </view>
        </view>
        <!-- <view class="rowsb rowsm mt-20 fs-26">
          <uni-tooltip :content="proxyNameList.join(',') || taskInfo.xyName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 面向学院：</text>
              <text>{{ proxyNameList.join(',') || taskInfo.xyName }}</text>
            </view>
          </uni-tooltip>
          <uni-tooltip :content="prozyNameList.join(',') || taskInfo.zyName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 面向专业：</text>
              <text> {{ prozyNameList.join(',') || taskInfo.zyName }}</text>
            </view>
          </uni-tooltip>
        </view>
        <view class="rowsb rowsm mt-20 fs-26">
          <uni-tooltip :content="probjNameList.join(',') || taskInfo.bjName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 面向班级：</text>
              <text>{{ probjNameList.join(',') || taskInfo.bjName }}</text>
            </view>
          </uni-tooltip>
          <uni-tooltip :content="taskInfo.faceNj || taskInfo.njName" placement="top">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 面向年级：</text>
              <text>{{ taskInfo.faceNj || taskInfo.njName }}</text>
            </view>
          </uni-tooltip>
        </view> -->
        <view class="ellipsis-text mt-20">
          <text class="fw-600 fs-26"> 任务时间：</text>
          <text>{{ startTime }}~{{ endTime }}</text>
        </view>
        <view class="ellipsis-text mt-10">
          <text class="fw-600 fs-26"> 所属学期: </text>
          <text class="pl-20">{{ taskInfo.semesterConfigName }}</text>
        </view>
        <view class="ellipsis-text mt-10">
          <text class="fw-600 fs-26"> 发布时间：</text>
          <text>{{ (taskInfo.releaseTime || '').slice(0, 16) }}</text>
        </view>
        <view class="ellipsis-text mt-10" v-if="taskInfo.noPassPoints > 0">
          <text class="fw-600 fs-26"> 若审核不通过扣除积分数：</text>
          <text>{{ taskInfo.noPassPoints }}</text>
        </view>
      </uni-card>
      <uni-card>
        <view class="inforClass"> 参与情况：</view>
        <view class="rowsb rowsm mt-20 fs-24">
          <view style="width: 62%">
            <text class="fw-600 fs-26"> 参与方式：</text>
            <text>
              {{ taskInfo.participationWay == 1 ? '指定学生参与' : '学生自选报名' }}
            </text>
          </view>
          <view style="width: 38%" v-if="taskInfo.participationWay == 2">
            <text class="fw-600 fs-26"> 人数限制：</text>
            <text>{{ taskInfo.applyCount || 0 }} / {{ taskInfo.peoplesNumberAstrict }}</text>
          </view>
        </view>
        <view v-if="taskInfo.participationWay == 2">
          <view class="rowsb rowsm mt-20 fs-24">
            <view class="ellipsis-text" style="width: 62%">
              <text class="fw-600 fs-26"> 报名审核：</text>
              <text>{{ taskInfo.applyCheck == 0 ? '无需审核，直接参与' : '需要审核通过后参与' }}</text>
            </view>
            <view style="width: 38%" @click="typeAudit ? '' : open()">
              <text class="fw-600 fs-26"> 学生范围：</text>
              <text :style="typeAudit ? '' : 'color:#007AFF;'">
                {{ taskInfo.studentNumber || (taskInfo.studentIds || []).length }}
              </text>
            </view>
          </view>
          <view class="rowsb rowsm mt-20 fs-24">
            <view class="ellipsis-text">
              <text class="fw-600 fs-26"> 报名时间：</text>
              <text>{{ (taskInfo.applyStartTime || '').slice(0, 10) }}~{{ (taskInfo.applyEndTime || '').slice(0, 10)
              }}</text>
            </view>
          </view>
          <view class="ellipsis-text mt-20" v-if="taskInfo.applyPassCancelPoints > 0">
            <text class="fw-600 fs-26"> 爽约扣除积分数 ( {{ taskInfo.applyPassCancelPoints }} ) 分</text>
          </view>
        </view>
        <view class="mt-20 fs-24" @click="typeAudit ? '' : open()" v-else>
          <text class="fw-600 fs-26"> 学生范围：</text>
          <text :style="typeAudit ? '' : 'color:#007AFF;'">
            {{ taskInfo.studentNumber || (taskInfo.studentIds || []).length }}
          </text>
        </view>
      </uni-card>
      <view v-if="!typeAudit">
        <!-- 任务要求 -->
        <uni-card>
          <view class="inforClass"> 任务要求：</view>
          <view class="task-require">{{ taskInfo.taskRequire || '无' }}</view>
        </uni-card>
        <!-- 注意事项 -->
        <uni-card margin="0">
          <view class="inforClass">注意事项：</view>
          <view class="task-require">{{ taskInfo.mattersNeedAttention || '无' }}</view>
        </uni-card>
        <!-- 附件 -->
        <uni-card v-if="taskInfo.fileList && taskInfo.fileList.length > 0">
          <view class="inforClass">附件:</view>
          <view>
            <view v-for=" item  in  taskInfo.fileList " :key="item.id">
              <image :src="item.fileSrc" class="w-200 h-200 br-20"
                v-if="item.fileType == 'png' || item.fileType == 'jpg' || item.fileType == 'jpeg' || item.fileType == 'gif'"
                mode="aspectFill" @click="openImg(item.fileSrc)">
              </image>
              <video id="myVideo" :src="item.fileSrc" class="w-200 h-200 br-20" v-if="item.fileType == 'mp4'"
                @click="openVideo(item.fileSrc)"></video>
              <view class="w100 h-140 br-10 rows rowsm pl-40" style="background-color: #F7F6FA;"
                v-if="item.fileType != 'png' && item.fileType != 'jpg' && item.fileType != 'jpeg' && item.fileType != 'gif' && item.fileType != 'mp4'"
                @click="openFile(item)">
                <image src="/static/file.png" class="w-60 h-60 mr-20" mode=""></image>
                <view class="fs-28 col888 w100 one_overflow">{{ item.fileName }}</view>
              </view>
            </view>
          </view>
        </uni-card>
      </view>

      <view v-if="auditState && typeAudit">
        <uni-card>
          <view class="inforClass">报告信息</view>
          <view class="rowsb rowsm mb-20 mt-20 fs-26">
            <uni-tooltip :content="taskInfo.projectName" placement="top" style="width: 60%">
              <view class="ellipsis-text">
                <text class="fs-26 fw-600"> 实践报告名称：</text>
                <text>{{ taskInfo.projectName }}</text>
              </view>
            </uni-tooltip>
            <view>
              <text class="fs-26 fw-600"> 状态：</text>
              <text>{{ taskInfo.status == 1 ? '未审批' : taskInfo.status == 2 ? '审核通过' : '已驳回' }}</text>
            </view>
          </view>
          <view class="rowsb rowsm mb-20 mt-20 fs-24">
            <view>
              <text class="fs-26 fw-600"> 实践时间：</text>
              {{ taskInfo.practiceStartTime }}~{{ taskInfo.practiceEndTime }}
            </view>
          </view>
          <!-- <view class="rowsb rowsm mb-20 mt-20 fs-26">
            <text>实践结束时间：</text>
          </view> -->
          <view class="rowsb rowsm mb-20 mt-20 fs-24">
            <view>
              <text class="fs-26 fw-600"> 实践地点：</text>
              {{ taskInfo.practicePlace }}
            </view>
          </view>
          <view>
            <view class="mb-10 mt-5 fs-26 fw-600">实践详细说明：</view>
            <view class="task-require" style="margin-top: 0;">{{ taskInfo.detail || '无' }}</view>
          </view>
          <view v-if="typeAudit == 2 && auditState == 1">
            <view class="mt-20 fs-26">评语：</view>
            <view class="task-require">
              <textarea class="fw-n h-100" style="width: 100%" v-model="remark" placeholder="选填"></textarea>
            </view>
          </view>
        </uni-card>
        <!-- 附件 -->
        <uni-card>
          <view class="w100 bgff br-10 mb-20">
            <view class="inforClass">填报附件:</view>
            <view v-if="taskInfo.studentFileList && taskInfo.studentFileList.length > 0">
              <view v-for=" item  in  taskInfo.studentFileList " :key="item.id">
                <image :src="item.fileSrc" class="w-200 h-200 br-20"
                  v-if="item.fileType == 'png' || item.fileType == 'jpg' || item.fileType == 'jpeg' || item.fileType == 'gif' || item.fileType == 'able' || item.fileType === '图片'"
                  mode="aspectFill" @click="openImg(item.fileSrc)">
                </image>
                <video id="myVideo" :src="item.fileSrc" class="w-200 h-200 br-20"
                  v-if="item.fileType == 'mp4' || item.fileType == 'avi' || item.fileType == '视频'"
                  @click="openVideo(item.fileSrc)"></video>
                <view class="w100 h-140 br-10 rows rowsm pl-40 mb-12" style="background-color: #F7F6FA;"
                  v-if="item.fileType != 'png' && item.fileType != 'jpg' && item.fileType != 'jpeg' && item.fileType != 'able' && item.fileType != 'mp4' && item.fileType != 'avi' && item.fileType != '图片' && item.fileType != '视频'"
                  @click="openFile(item)">
                  <image src="/static/file.png" class="w-60 h-60 mr-20" mode=""></image>
                  <view class="fs-28 col888 w100 one_overflow">{{ item.fileName }}</view>
                </view>
              </view>
            </view>
          </view>
        </uni-card>
      </view>
      <!-- 驳回 -->
      <uni-card v-if="taskInfo.status == 4 && taskInfo.reason">
        <view class="w100 bgff br-10 mb-20">
          <view class="inforClass">驳回:</view>
          <view>{{ taskInfo.reason }}</view>
        </view>
      </uni-card>
      <!-- 审核情况 -->
      <uni-card v-if="typeAudit">
        <view class="w100 bgff br-10 mb-20">
          <view class="inforClass">审核情况:</view>
          <uni-section title="基本用法" type="line" padding>
            <uni-steps :options="list1" :active="active" />
          </uni-section>
        </view>
      </uni-card>
    </view>
    <uni-popup ref="popup" background-color="#fff">
      <view style="width: 100%; height: 60vh;">
        <view class="w100 h-82 rowsc rowsm">
          <view class="rows rowsm">
            <view class="w-48 h-8" style="background: linear-gradient(to right,#F7F7F7,#4889FF);"></view>
            <view class="fs-30 col333 fw-b ml-10 mr-10">学生详情</view>
            <view class="w-48 h-8" style="background: linear-gradient(to left,#F7F7F7,#4889FF);"></view>
          </view>
        </view>
        <view style="height: 100%;overflow-y: auto;">
          <view class="mt-20 p-all-10 fs-32" style="display: flex;text-align: center;background: #F4F7FF;">
            <view class="pr-10" style="width: 20%;">学生</view>
            <view class="pr-10" style="width: 20%;">学号</view>
            <view class="pr-10" style="width: 20%;">学院</view>
            <view class="pr-10" style="width: 20%;">专业</view>
            <view style="width: 20%;">班级</view>
          </view>
          <view class="pt-20" style="display: flex;text-align: center;align-items: stretch;"
            v-for="( item, index ) in  prouserAllList " :key="item.userId"
            :style="index % 2 == 0 ? 'background:#fff;' : 'background:#F4F4F4;'">
            <view class="pr-10" style="width: 20%;">{{ item.name }}</view>
            <view class="pr-10" style="width: 20%;word-wrap: break-word; white-space: normal;">
              {{ item.stNumber }}
            </view>
            <view class="pr-10" style="width: 20%;">{{ item.xyName }}</view>
            <view class="pr-10" style="width: 20%;">{{ item.zyName }}</view>
            <view style="width: 20%;">{{ item.njName }}</view>
          </view>
        </view>
      </view>
    </uni-popup>

    <view class="w100 rowsa rowsm mt-30 mb-30" style="bottom: 100rpx;"
      v-if="typeAudit && (auditState == 1 && typeAudit == 2 && (permissions.find(v => v == '*:*:*') || permissions.find(v => v == 'practice:user:collegeCheck')))">
      <view class="w-202 h-84 br-42 rowsc rowsm colfff" style="background: linear-gradient(to bottom,#64606b,#64606b);"
        @click="submit(4)">驳回</view>
      <view class="w-202 h-84 br-42 rowsc rowsm colfff" style="background: linear-gradient(to bottom,#4897FF,#4878FF);"
        @click="submit(typeAudit)">通过</view>
    </view>
  </view>
</template>

<script>
import axios from 'axios';
import { Base64 } from 'js-base64';
import tools from '@/common/tools.js'
export default {
  data() {
    return {
      taskInfo: {},
      title: '',
      itemData: {},
      data: {},
      scoreList: [],
      scoreIndex: null,
      content: '',
      noPassContent: '',
      index: '',
      startTime: '',
      endTime: '',
      id: '',
      typeAudit: null,
      auditState: null,
      remark: null,

      prozyNameList: [],
      proxyNameList: [],
      probjNameList: [],
      active: 1,
      list1: [],
      permissions: [],
      practiceType: [],
      prouserAllList: []
    };
  },
  onLoad(e) {
    if (uni.getStorageSync('flag') == 'teacher') {
      this.$tools.axiosFromToken('POST', 'sysUser/getById', {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        let getAllInfo = { ...res.data, user: JSON.parse(Base64.decode(res.data.user)) }
        uni.setStorageSync('getInfo', getAllInfo);
        this.permissions = res.data.permissions.flat() || [];
      })
    }
    this.getTypeCongfigList();
    this.id = e.id;
    this.typeAudit = e.typeAudit;
    this.auditState = e.auditState;
    this.getTaskInfo(e.id);
    // this.permissions = uni.getStorageSync('getInfo').permissions.flat() || [];

    uni.setNavigationBarTitle({
      title: this.typeAudit ? '实践报告详情' : '实践任务详情'
    })
  },
  onReady() {
    // this.$refs.popup.open()
  },
  methods: {
    open() {
      this.$refs.popup.open('bottom')
    },
    getTypeCongfigList() {
      this.$tools.axiosFromToken('GET', 'project/practice/type/config/list?pageNum=1&pageSize=50', {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        res.rows.forEach(item => {
          this.practiceType.push({ name: item.name, value: item.id })
        })
      })
    },
    async fetchImage(urls, index) {
      const that = this;
      try {
        const response = await axios.get(this.$tools.avatarUrl + urls, {
          responseType: 'arraybuffer' // 获取二进制数据
        });
        const blob = new Blob([response.data], { type: 'image/jpeg' });
        const imageUrl = URL.createObjectURL(blob);
        if (this.auditState && this.typeAudit) {
          that.taskInfo.studentFileList[index].fileSrc = imageUrl;
        } else {
          that.taskInfo.fileList[index].fileSrc = imageUrl;
        }
        that.$forceUpdate();
      } catch (error) {
        console.error('Failed to fetch image:', error);
      }
    },
    openImg(url) {
      let urlList = [];
      (this.taskInfo.studentFileList || this.taskInfo.fileList).forEach(item => {
        if (item.fileType == 'jpg' || item.fileType == 'png' || item.fileType == 'jpeg' || item.fileType == 'gif' || item.fileType == 'able' || item.fileType == '图片') {
          urlList.push(item.fileSrc)
        }
      });
      uni.previewImage({
        current: url,
        urls: urlList,
        loop: false,
        indicator: 'number',
      });
    },
    openVideo(url) {
      var video = document.getElementById("myVideo");
      // 检查浏览器是否支持全屏 API
      if (video.requestFullscreen) {
        // 支持 requestFullscreen 的浏览器
        video.requestFullscreen();
      } else if (video.mozRequestFullScreen) {
        // Firefox 支持 mozRequestFullScreen
        video.mozRequestFullScreen();
      } else if (video.webkitRequestFullscreen) {
        // Chrome 和 Safari 支持 webkitRequestFullscreen
        video.webkitRequestFullscreen();
      } else if (video.msRequestFullscreen) {
        // Internet Explorer 支持 msRequestFullscreen
        video.msRequestFullscreen();
      }
    },
    openFile(url) {
      const userAgent = navigator.userAgent.toLowerCase();
      if (userAgent.match(/MicroMessenger/i)) {
        const fileUrl = this.$tools.avatarUrl + url.file;
        window.open(fileUrl, '_blank');
      } else if (userAgent.match(/wxwork/i)) {
        const fileUrl = this.$tools.avatarUrl + url.file;
        window.open(fileUrl, '_blank');
      } else {
        const fileUrl = this.$tools.avatarUrl + url.file;
        fetch(fileUrl)
          .then(response => response.blob())
          .then(blob => {
            const link = document.createElement("a");
            link.href = URL.createObjectURL(blob);
            link.download = url.fileName; // 指定下载文件的默认名称
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            URL.revokeObjectURL(link.href); // 释放对象 URL
          })
          .catch(error => {
            console.error("下载失败：", error);
          });
      }
      // uni.downloadFile({
      //   url: this.$tools.avatarUrl + url,
      //   success(res) {
      //     uni.openDocument({
      //       filePath: res.tempFilePath,
      //       showMenu: true,
      //       complete(msg) {
      //         console.log(msg)
      //       }
      //     })
      //   }
      // })
    },
    getTaskInfo(id) {
      const interfaceName = this.auditState ? 'practice/user/' : 'teacher/project/task/'
      this.$tools.axiosFromToken('GET', `${interfaceName}${id}`, {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        this.$tools.axiosFromToken('GET', `project/apply/checkedStudentList?id=${id}`, {}, '加载中').then(res1 => {
          this.prouserAllList = res1.rows
        })
        this.taskInfo = { ...res.data };
        this.$nextTick(() => {
          if (this.auditState && this.typeAudit) {
            this.taskInfo.studentFileList.forEach((item, fileIndex) => {
              this.fetchImage(item.file, fileIndex)
            })
          } else {
            this.taskInfo.fileList.forEach((item, fileIndex) => {
              this.fetchImage(item.file, fileIndex)
            })
          }
        })
        this.startTime = this.taskInfo.startTime ? (this.taskInfo.startTime || '').slice(0, 10) : (this.taskInfo.studentStartTime || '').slice(0, 10);
        this.endTime = this.taskInfo.endTime ? (this.taskInfo.endTime || '').slice(0, 10) : (this.taskInfo.studentEndTime || '').slice(0, 10);
        const timeFields = [
          { key: 'createTime', title: '创建时间', activeValue: 0 },
          { key: 'collegeCheckTime', title: this.taskInfo.status == 4 && !this.taskInfo.schoolCheckTime ? '驳回时间' : '审核时间', activeValue: 1 },
        ];
        timeFields.forEach(field => {
          if (this.taskInfo[field.key]) {
            this.active = field.activeValue;
            this.list1.push({ title: field.title, desc: this.taskInfo[field.key] + (field.title != '创建时间' ? '\n审核人: ' + (this.taskInfo.collegeCheckName || '') : '') });
          }
        });
        if (this.taskInfo.faceZy) {
          this.getListProxy();
          this.getListProzy();
          this.getListProbj();
        }
      })
    },
    submit(type) {
      const data = {
        ids: [this.id],
        status: type,
        remark: this.remark
      }
      if (type == 4) {
        uni.showModal({
          title: '驳回原因',
          content: '',
          editable: true,
          placeholderText: '请填写驳回原因',
          success: (promptRes) => {
            if (promptRes.confirm) {
              // 用户确认了输入框的内容
              const reason = promptRes.content;  // 获取用户输入的驳回理由

              if (reason.trim() === '') {
                // 如果输入为空，提醒用户填写驳回理由
                uni.showToast({
                  title: '驳回理由不能为空',
                  icon: 'none',
                });
                return;
              }
              if (this.taskInfo.status == 1) {
                data.collegeCheckTime = this.getDate();
              } else {
                data.schoolCheckTime = this.getDate();
              }
              data.reason = reason;
              this.$tools.axiosFromToken('POST', 'practice/user/check', JSON.stringify(data), '加载中').then(res => {
                this.$tools.showtt(res.msg)
                if (res.code != 200) return
                setTimeout(() => {
                  this.$tools.goBack(1)
                }, 1000)
              })
            }
          }
        })
      } else {
        this.$tools.axiosFromToken('POST', 'practice/user/check', JSON.stringify(data), '加载中').then(res => {
          this.$tools.showtt(res.msg)
          if (res.code != 200) return
          setTimeout(() => {
            this.$tools.goBack(1)
          }, 1000)
        })
      }
    },
    getDate() {
      const now = new Date();

      const year = now.getFullYear();  // 获取年份
      const month = String(now.getMonth() + 1).padStart(2, '0');  // 获取月份，月从 0 开始，所以需要加 1，使用 padStart 补充零
      const day = String(now.getDate()).padStart(2, '0');  // 获取日期，使用 padStart 补充零

      const hours = String(now.getHours()).padStart(2, '0');  // 获取小时，补充零
      const minutes = String(now.getMinutes()).padStart(2, '0');  // 获取分钟，补充零
      const seconds = String(now.getSeconds()).padStart(2, '0');  // 获取秒数，补充零

      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    },
    // 查询学院
    getListProxy() {
      this.$tools.axiosFromToken('GET', 'project/proxy/listTotal', {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        this.proxyNameList = [];
        res.rows.forEach(v => {
          this.taskInfo.faceXy.split(',').forEach(y => {
            if (v.id == y) {
              this.proxyNameList.push(v.name)
            }
          })
        })
      })
    },

    getListProzy() {
      this.$tools.axiosFromToken('GET', 'project/prozy/listTotal', {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        this.prozyNameList = [];
        res.rows.forEach(v => {
          this.taskInfo.faceZy.split(',').forEach(y => {
            if (v.id == y) {
              this.prozyNameList.push(v.name)
            }
          })
        })
      })
    },
    getListProbj() {
      this.$tools.axiosFromToken('GET', 'project/probj/listTotal', {}, '加载中').then(res => {
        if (res.code != 200) return this.$tools.showtt(res.msg)
        this.probjNameList = [];
        res.rows.forEach(v => {
          this.taskInfo.faceBj.split(',').forEach(y => {
            if (v.id == y) {
              this.probjNameList.push(v.name)
            }
          })
        })
      })
    },
    pass() {
      this.$tools.goBack(1)
    },
    noPass() {
      this.$tools.goBack(1)
    }
  }

}
</script>

<style lang="scss">
page {
  background-color: #f4f5f7;
}

.mark {
  text-align: right;
  color: #f92929;
}

::v-deep .uni-tooltip {
  width: 50%;
  display: flex;
}

::v-deep .uni-tooltip-popup {
  top: 20px;
  right: 0;
  text-align: justify;
  word-wrap: break-word;
}

.ellipsis-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: inline-block;
  align-items: center;
}

::v-deep .uni-card {
  margin-left: 5px !important;
  margin-right: 5px !important;
  overflow: visible;
}

::v-deep .uni-card__content {
  color: #000 !important;
}

.inforClass {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  margin: 8px 0;
}

.inforClass::before {
  content: '';
  width: 5px;
  height: 20px;
  background-color: #007AFF;
  margin-right: 5px;
  display: inline-block;
}

.txt-warp {
  display: flex;
  justify-content: space-between;
  margin-top: 30rpx;

  .left,
  .center,
  .right {
    text {
      display: block;
      white-space: nowrap;
      font-size: 24rpx;
      color: #333;
      margin-bottom: 20rpx;
    }
  }
}

.txt {
  font-size: 24rpx;
  color: #333;
}

.title {
  font-size: 30rpx;
  color: #333;
  font-weight: bold;
  margin-top: 30rpx;
}

.task-require {
  margin-top: 10rpx;
  border: 1px solid #c2bfbf;
  padding: 20rpx;
  border-radius: 10rpx;

  .title {
    font-size: 30rpx;
    color: #333;
    font-weight: bold;
    margin-top: 10rpx;
  }

  .txt {
    font-size: 24rpx;
    color: #4e4e4e;
    margin-top: 10rpx;
  }
}

.btn {
  margin: 0 auto;
  margin-top: 50px;
  width: 300px;
  font-size: 26rpx;
  border: 1px solid #f9ae3d;
  padding: 10px 20px;
  border-radius: 20px;
  text-align: center;
  color: #f9ae3d;
  background: #fff;
}

.section-with-line {
  display: flex;
  align-items: flex-start;
  padding: 5px 0;
}

.line {
  width: 4px;
  height: 100%;
  flex-shrink: 0;
  background-color: #007AFF;
  margin-right: 10px;
  overflow: hidden;
}

.content {
  flex: 1;
}
</style>
